public class ArrayUtil {

    public static Object [] distinct(Object [] arr,IDistinct dist){
        Object [] newArr = new Object[arr.length];
        int index = 0;
        for (int i = 0;i < arr.length;i++){
            boolean flag = false;
            for (int j = 0;j < index;j++){
                if(dist.distinct(arr[i],newArr[j])){
                    flag = true;
                    break;
                }
            }
            if(!flag){
                newArr[index++] = arr[i];
            }
        }
        Object [] distArr = new Object[index];
        for(int i = 0;i < distArr.length;i++){
            distArr[i] = newArr[i];
        }
        return distArr;
    }
}
